package com.lsk.mps.backend.util;

import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

import java.lang.reflect.MalformedParameterizedTypeException;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class SseEmittersHolder {
    private static final Map<String, SseEmitter> HOLDER = new HashMap<>();

    public static void putEmitter(String id, SseEmitter emitter) {
        HOLDER.put(id, emitter);
    }

    public static SseEmitter getEmitter(String id) {
        return HOLDER.get(id);
    }

    public static void deleteEmitter(String id) {
        HOLDER.remove(id);
    }

    public static Set<Map.Entry<String, SseEmitter>> emitters() {
        return HOLDER.entrySet();
    }
}
